package com.it.controller;

import com.it.annotaion.Controller;
import com.it.annotaion.Qualifier;
import com.it.annotaion.RequestMapping;
import com.it.service.UserService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author zq
 * @create 2019-12-07
 */
@Controller("userController")
@RequestMapping("/user")
public class UserController {

    @Qualifier("userService")
    private UserService userService ;

    @RequestMapping("/name")
    public void getUserName(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String name = userService.getName();

        request.setAttribute("name",name);

        System.out.println("跳转。。。");
        request.getRequestDispatcher("/result.jsp").forward(request,response);
    }
}
